import request from '@/utils/request'

/* 获取所有分类的接口 */
export const fetchCategoryListAPI = (pageParams) => {
  return request({
    url: '/category/page',
    method: 'GET',
    params: pageParams
  })
}

/* 删除分类的接口 */
export const deleteCategoryAPI = (id) => {
  return request({
    url: `/category`,
    method: 'DELETE',
    params: {
      id
    }
  })
}

/* 更新分类状态的接口 */
export const updateCategoryStatusAPI = (status, id) => {
  return request({
    url: `/category/status/${status}`,
    method: 'POST',
    params: {
      id
    }
  })
}

/* 新增套餐分类或者菜品分类的接口 */
export const addCategoryAPI = (data) => {
  return request({
    url: `/category`,
    method: 'POST',
    data
  })
}

/* 更新分类的接口 */
export const updateCategoryAPI = (data) => {
  return request({
    url: `/category`,
    method: 'PUT',
    data
  })
}

